#include<iostream>
using namespace std;
int main()
{
	int bTime,eTime;
	int finTime;
	cin>>bTime;
	cin>>eTime;
	
	int bm,bs; 
	int em,es;
	
	bm=bTime/100;bs=bTime%100;
	em=eTime/60;es=eTime%60;
	
	int finm,fins;
	fins=bs+es;
	finm=bm+em;
	
	
	if(fins>=60){
		fins-=60;
		finm+=1;
	}
	if(fins<0){
		fins+=60;
		finm-=1;
	}
	if(finm>=24){
		finm-=24;
	}
	if(finm<0){
		finm+=24;
	}
	cout<<finm*100+fins<<endl;
	return 0;
}
